/***************************************************************************
 *   Copyright (C) 2007 by Gaetano Mendola   *
 *   mendola@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef PLAYER_H
#define PLAYER_H

#include <list>

//Events
#include "events/eventsink.h"

//Support
#include "support/noncopyable.h"

//Buffs
#include "buffs/buff.h"

//Forward declarations
class Weapon;
namespace Talents { class Talent; }
namespace Buffs { class Buff; }
namespace Stats { class Stat; }

/**
	@author Gaetano Mendola <mendola@gmail.com>
*/
class Player : public Events::EventSink, private Support::NonCopyable
{
private:
    typedef std::list<const Talents::Talent*> TalentList;
    TalentList theTalents;

    typedef std::list<Buffs::Buff*> BuffList;
    BuffList theBuffs;

    typedef std::list<Stats::Stat*> StatList;
    StatList theStats;

public:
    Player();
    virtual ~Player();

    void addTalent(Talents::Talent* aTalent);

    //Buffs managments
    void addBuff(Buffs::Buff* aBuff);
    void removeBuff(Buffs::Buff* aBuff);

    bool buffActive(Buffs::Buff::Id anId) const;
    ///////////////////////////////////////////////////////////////

    //Stats managments
    void addStat(Stats::Stat* aStat);
    typedef StatList::iterator stat_iterator;
    typedef StatList::const_iterator const_stat_iterator;

    stat_iterator       begin_stats()       { return theStats.begin(); }
    const_stat_iterator begin_stats() const { return theStats.begin(); }

    stat_iterator       end_stats()       { return theStats.end(); }
    const_stat_iterator end_stats() const { return theStats.end(); }
    ///////////////////////////////////////////////////////////////


    void equipInMainHand(Weapon* aWeapon);
    void equipInOffHand(Weapon* aWeapon);

    const Weapon* mainHandWeapon() const { return theMainHandWeapon; }
          Weapon* mainHandWeapon() { return theMainHandWeapon; }

    const Weapon* offHandWeapon() const { return theOffHandWeapon; }
          Weapon* offHandWeapon() { return theOffHandWeapon; }

private:
    Weapon*  theMainHandWeapon;   //Main Hand Slot
    Weapon*  theOffHandWeapon;    //Off Hand Slot
};

#endif
